package com.dbpms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dbpms.mapper.NoticeMapper;
import com.dbpms.pojo.Noticeinfo;
import com.dbpms.service.INoticeService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Noticeinfo> implements INoticeService {
    /**
     * 获取所有公告内容
     * @return
     */
    @Override
    public List<Noticeinfo> queryNoticeInfo() {
        return lambdaQuery()
                .list();
    }

    /**
     * 模糊查询公告信息
     * @param title
     * @return
     */
    @Override
    public List<Noticeinfo> titleQueryNoticeInfo(String title) {
        return lambdaQuery()
                .like(Noticeinfo::getNoticeTitle,title)
                .list();
    }

    /**
     * 新增公告
     * @param noticeinfo
     * @return
     */
    @Override
    public boolean addNoticeInfo(Noticeinfo noticeinfo) {
        return save(noticeinfo);
    }

    /**
     * 删除公告
     * @param notice_id
     * @return
     */
    @Override
    public boolean deleteNoticeInfo(int notice_id) {
        return removeById(notice_id);
    }
}
